﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DGSFramework;

namespace Framework
{
    public partial class Landingpage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        public void SetLanguage(object sender, EventArgs e)
        {
            if (Globals.CheckRewriteUrl() == false)
            {
                Session["language"] = ((ImageButton)sender).Attributes["rel"].ToString();
                Response.Redirect(Request.RawUrl);
            }
            else
            {
                Session["language"] = ((ImageButton)sender).Attributes["rel"].ToString();
                if (Request.Url.LocalPath.ToLower().Contains("default.aspx"))
                {
                    Response.Redirect(ResolveUrl("~/"));
                }
                else
                {
                    //Response.Redirect(ResolveUrl("~/"));
                    //Response.Redirect(Request.ServerVariables["HTTP_X_REWRITE_URL"]);
                    if (Request.ServerVariables["HTTP_X_REWRITE_URL"] != null)
                        Response.Redirect(Request.ServerVariables["HTTP_X_REWRITE_URL"]);
                    else
                        Response.Redirect(Request.RawUrl);
                }
            }
        }
    }
}